home *** CD-ROM | disk | FTP | other *** search
Wrap
/* AmIRC XDCC script v1.30 by WiZ-Id (wizkid@crocker.com). Works only with AmIRC V0.76Beta or higher. Converted from Josef Faulkner's Grapevine XDCC script. $VERS: AmIRC XDCC.AmIRX Version 1.30 (12.27.95) Installation: Add an ALIAS of /xdcc to "/rx rexx/xdcc.amirx %p" in the LIST SETUP window. Add rexx/xdcc.amirx PMSG or CTCP to Setup/Events "Private Message" and & "CTCP" Rexx strings. Assign xdcc: to a directory where your xdcc files are to be stored For more (better) instructions, look to the readme file. History: V1.01 A few little fixes... maybe this will help V1.02 Should have fixed the loopback problems.... { V1.03 More little bug fixes e.g (XDCC HELP), cosmetic fixes (done by Stoebi) { V1.03 More cosmetic fixes (correct from *IX) (Pal) { V1.03 Mostly PhoEniX compatible commands (Pal) V1.04 Implements changes on 1.03 into the 1.02 version. V1.03 did not have the Loop bug fixed. V1.10 Added PACKET's!!! See Readme! V1.11 Just cleaning up version numbers V1.20 SLOTS! V1.30 Auto OP list... & Extended Local Help V1.30 SET SWITCH and OPSWITCH to control features. Help Text: % @ AmIRC XDCC command help: Usage: xdcc <cmd> [arg] <cmd> can be any of the following: LIST - View a list of offered packs. GET #<N> - Request pack #<N> for DCC. HELP - See this help listing @ ADD <filename> <description> - Add a file to your list OFFER <filename> <desc> - Same as ADD LIST [#|<nick>] - Send list to channel (#) or nick NOTICE <#> - Pulbic notice to channel (#) of offer SEND <nick> <pack #|file> - To send file(s) to someone DEL <file|pack #> - Removes the item from your list REM <file|pack #> - Same as DEL DOFFER <file|pack #> - Same as DEL FADD <nick> - Add <nick> to your friends list ADDF <nick> - Same as FADD FLIST - List your Friends LISTF - Same as FLIST FREM <number> - Remove someone from your friends list FDEL <number> - Same as FREM REMF <number> - Same as FREM OPADD <nick> - Add <nick> to your OPs list ADDOP <nick> - Same as OPADD OPLIST - List your OPs LISTOP - Same as OPLIST OPREM <number> - Remove someone from your OPs list OPDEL <number> - Same as OPREM REMOP <number> - Same as OPREM SET SEC|KICK <ON|OFF> - Set the security or kick functions to on or off SET MAX <slots> - Set the maximum number of DCC slots SET SWITCH <ON|OFF> - Set XDCC to ON or OFF SET OPSWITCH <ON|OFF> - Set AutoOP feature to ON or OFF INFO [#|<nick>] - To show current settings % */ options results if ~show('L','rexxsupport.library') then if ~addlib('rexxsupport.library',0,-30,0) then do 'echo You need rexxsupport.library version 30 or greater in libs:' exit 10 end PARSE ARG CMD NAME FILE CMD=UPPER(STRIP(CMD)) NAME=STRIP(NAME) FILE=STRIP(FILE) /************************/ /******* DEFAULTS *******/ /************************/ /**/ Security='OFF' /**/ /**/ Kick='OFF' /**/ /**/ Maxslots=5 /**/ /**/ Switch='ON' /**/ /**/ OpSwitch='OFF' /**/ /************************/ getmynick mynick=result getlastline last=result b=d2c(2) u='' sfile='xdcc:list' ffile='xdcc:friends' ofile='xdcc:oplist' IF exists('env:XDCCSWITCH') THEN Do Open(1,'ENV:XDCCSWITCH',r) Switch=Word(Readln(1),1) Close(1) END IF exists('env:XDCCOPSWITCH') THEN Do Open(1,'ENV:XDCCOPSWITCH',r) OpSwitch=Word(Readln(1),1) Close(1) END IF exists('env:XDCCSECURITY') THEN Do Open(1,'ENV:XDCCSECURITY',r) Security=Word(Readln(1),1) Close(1) END IF exists('env:XDCCKICK') THEN Do Open(1,'ENV:XDCCKICK',r) Kick=Word(Readln(1),1) Close(1) END IF exists('env:XDCCMAX') THEN Do Open(1,'ENV:XDCCMAX',r) Maxslots=Word(Readln(1),1) Close(1) END SELECT WHEN (CMD='ADD')|(CMD='OFFER') THEN DO if exists('xdcc:'name) then do if exists(sfile) then call open(1,sfile,a) else call open(1,sfile,w) IF Right(name,1)='/' THEN DO call writeln(1,name' 'file' PACK') pname=left(name,pos('/',name)-1) ADDRESS COMMAND 'c:list xdcc:'name'#? LFORMAT="%n %l" >xdcc:'pname'list' call close(1) END ELSE DO call writeln(1,name' 'file) call close(1) END cnt=0 call open(1,sfile,r) do until eof(1) call readln(1) cnt=cnt+1 end call close(1) 'echo 'u||name||u' added to list as number 'cnt-1'.' end END WHEN (CMD='FADD')|(CMD='ADDF') THEN DO "userhost "name file=result IF Datatype(left(Right(file,Length(file)-Pos("@",file)),1),n) THEN file=Left(file,pos('.',file,Length(file)-4))||"*" ELSE file=Left(file,pos('@',file))||"*."||Right(file,Length(file)-Pos(".",file)) if exists(ffile) then call open(1,ffile,a) else call open(1,ffile,w) call writeln(1,name' 'file) call close(1) cnt=0 call open(1,ffile,r) do until eof(1) call readln(1) cnt=cnt+1 end call close(1) 'echo 'u||name||u' added to friends list as number 'cnt-1'.' 'RAW PRIVMSG 'name' :You have been added to 'mynick||d2c(39)'s Friends list' end WHEN (CMD='FLIST')|(CMD='LISTF') THEN call flist WHEN (CMD='FREM')|(CMD='FDEL')|(CMD='REMF') THEN CALL FDEL WHEN (CMD='OPADD')|(CMD='ADDOP') THEN DO "userhost "name file=result IF Datatype(left(Right(file,Length(file)-Pos("@",file)),1),n) THEN file=Left(file,pos('.',file,Length(file)-4))||"*" ELSE file=Left(file,pos('@',file))||"*."||Right(file,Length(file)-Pos(".",file)) if exists(ofile) then call open(1,ofile,a) else call open(1,ofile,w) call writeln(1,name' 'file) call close(1) cnt=0 call open(1,ofile,r) do until eof(1) call readln(1) cnt=cnt+1 end call close(1) 'echo 'u||name||u' added to OPs list as number 'cnt-1'.' 'RAW PRIVMSG 'name' :You have been added to 'mynick||d2c(39)'s OPs list' END WHEN (CMD='OPLIST')|(CMD='LISTOP') THEN call oplist WHEN (CMD='OPREM')|(CMD='OPDEL')|(CMD='REMOP') THEN CALL OPDEL when (CMD='REM')|(CMD='DEL')|(CMD='DOFFER') then do if exists(sfile) then do call open(1,sfile,r) call open(2,'T:xdcc.temp',w) nfound=1 if datatype(name,n) then do cnt=0 do until eof(1) cnt=cnt+1 text=readln(1) if cnt~=name then call writeln(2,text) else do if eof(1)=0 then do 'echo Removing Item #'cnt', 'u||text||u' from xdcc list.' nfound=0 end end end end else do do until eof(1) text=readln(1) if word(upper(text),1)~=upper(name) then call writeln(2,text) else do 'echo Removing 'u||text||u' from xdcc list.' nfound=0 end end end call close(1) call close(2) if nfound then 'echo Nothing removed.' else do if exists('T:xdcc.temp') then do call open(1,'T:xdcc.temp',r) call open(2,sfile,w) cnt=1 do until eof(1) text=readln(1) if (~eof(1))&(strip(text)>0) then do call writeln(2,text) cnt=0 end end call close(1) call close(2) call delete('T:xdcc.temp') end if cnt then do 'echo List now empty.' call delete(sfile) end end end else 'echo List is empty.' end when CMD='NOTICE' then do name='#' call xdccinfo END when cmd='LIST' then call xdcclist when cmd='SEND' then call xdccsend when cmd='GET' then call xdccsend when cmd='HELP' then call xdcclocalhelp when cmd='INFO' then call xdccinfo WHEN cmd='SET' then DO IF Left(Upper(name),3)='MAX' THEN DO Open(1,'ENV:XDCCMAX',w) Writeln(1,Upper(file)) Close(1) END IF Left(Upper(name),3)='SWI' THEN DO Open(1,'ENV:XDCCSWITCH',w) Writeln(1,Upper(file)) Close(1) END IF Left(Upper(name),3)='OPS' THEN DO Open(1,'ENV:XDCCOPSWITCH',w) Writeln(1,Upper(file)) Close(1) END IF Left(Upper(name),3)='SEC' THEN DO Open(1,'ENV:XDCCSECURITY',w) Writeln(1,Upper(file)) Close(1) IF Upper(file)='OFF' THEN DO Open(1,'ENV:XDCCKICK',w) Writeln(1,Upper(file)) Close(1) END END IF Left(Upper(name),3)='KIC' THEN DO Open(1,'ENV:XDCCKICK',w) Writeln(1,Upper(file)) Close(1) END END WHEN (CMD='JOIN')&(Opswitch='ON') THEN DO nick=LEFT(last,POS('!',last)-1) nick=DELSTR(nick,1,1) "userhost "nick xfile=result IF Datatype(left(Right(xfile,Length(xfile)-Pos("@",xfile)),1),n) THEN xfile=Left(xfile,pos('.',xfile,Length(xfile)-4))||"*" ELSE xfile=Left(xfile,pos('@',xfile))||"*."||Right(xfile,Length(xfile)-Pos(".",xfile)) Found=0 IF exists(ofile)then do call open(1,ofile,r) do until eof(1) fline=readln(1) IF Pos(xfile,fline) ~=0 THEN found=1 END call close(1) END IF Found THEN "SAY /OP "nick END WHEN (CMD='CTCP')|CMD='PMSG' THEN DO clast=UPPER(last) which=1 IF CMD='CTCP' THEN which=1 IF CMD='PMSG' THEN which=0 IF POS('OP',Left(Right(clast,Length(clast)-(POS(':',clast,2))-which),2)) ~=0 THEN DO nick=LEFT(last,POS('!',last)-1) nick=DELSTR(nick,1,1) IF Switch='OFF' THEN DO "RAW PRIVMSG "nick" :Sorry, AutoOP Service has been turned off" RETURN END "userhost "nick xfile=result IF Datatype(left(Right(xfile,Length(xfile)-Pos("@",xfile)),1),n) THEN xfile=Left(xfile,pos('.',xfile,Length(xfile)-4))||"*" ELSE xfile=Left(xfile,pos('@',xfile))||"*."||Right(xfile,Length(xfile)-Pos(".",xfile)) Found=0 IF exists(ofile)then do call open(1,ofile,r) do until eof(1) fline=readln(1) IF Pos(xfile,fline) ~=0 THEN found=1 END call close(1) END IF Found=0 THEN DO "RAW PRIVMSG "nick" :" u'AmIRC XDCC:'u' You are not allowed OPs!' IF kick='ON' THEN 'say /kick 'name' /CTCP 'name' OP KICK' RETURN END ELSE "SAY /OP "nick END IF POS('XDCC',Left(Right(clast,Length(clast)-(POS(':',clast,4))-which),4)) ~=0 THEN DO nick=LEFT(last,POS('!',last)-1) nick=DELSTR(nick,1,1) IF Switch='OFF' THEN DO "RAW PRIVMSG "nick" :Sorry, XDCC Service has been turned off" RETURN END SELECT WHEN POS('XDCC LIST',clast) ~=0 THEN DO "echo" "P="d2c(27)"bXDCC"d2c(27)"b LIST REQUEST FROM:"nick name=nick IF security='ON' THEN DO "userhost "name xfile=result IF Datatype(left(Right(xfile,Length(xfile)-Pos("@",xfile)),1),n) THEN xfile=Left(xfile,pos('.',xfile,Length(xfile)-4))||"*" ELSE xfile=Left(xfile,pos('@',xfile))||"*."||Right(xfile,Length(xfile)-Pos(".",xfile)) Found=0 IF exists(ffile)then do call open(1,ffile,r) do until eof(1) fline=readln(1) IF Pos(xfile,fline) ~=0 THEN found=1 END call close(1) END IF Found=0 THEN DO "RAW PRIVMSG "nick" :" u'AmIRC XDCC:'u' You are not allowed access!' IF kick='ON' THEN 'say /kick 'name' /CTCP 'name' XDCC KICK' RETURN END END call xdcclist END WHEN (POS('XDCC GET',clast) ~=0)|(POS('XDCC SEND',clast)~=0) THEN DO "echo" "P="d2c(27)"bXDCC"d2c(27)"b GET REQUEST FROM:"nick IF POS('#',clast) ~=0 THEN DO file=STRIP(LEFT(RIGHT(clast,LENGTH(CLAST)-POS('#',CLAST)),2)) IF datatype(file,n)=0 THEN file=STRIP(LEFT(file,1)) name=nick IF security='ON' THEN DO "userhost "name xfile=result IF Datatype(left(Right(xfile,Length(xfile)-Pos("@",xfile)),1),n) THEN xfile=Left(xfile,pos('.',xfile,Length(xfile)-4))||"*" ELSE xfile=Left(xfile,pos('@',xfile))||"*."||Right(xfile,Length(xfile)-Pos(".",xfile)) Found=0 IF exists(ffile)then do call open(1,ffile,r) do until eof(1) fline=readln(1) IF Pos(xfile,fline) ~=0 THEN found=1 END call close(1) END IF Found=0 THEN DO "RAW PRIVMSG "nick" :" u'AmIRC XDCC:'u' You are not allowed access!' IF kick='ON' THEN 'say /kick 'name' /CTCP 'name' XDCC KICK' RETURN END END call xdccsend END ELSE "RAW PRIVMSG "nick" :Try again, an error has occured" END WHEN POS('XDCC HELP',clast) ~=0 THEN DO "echo" "P="d2c(27)"bXDCC"d2c(27)"b HELP REQUEST FROM:"nick name=nick call xdcchelp END WHEN POS('XDCC VERSION',clast) ~=0 THEN "RAW PRIVMSG "nick" :XDCC Version 1.30 By WiZ-Id" OTHERWISE "RAW PRIVMSG "nick" :UNKNOWN COMMAND: use XDCC HELP for more info!" END END END OTHERWISE "ECHO" CMD END exit xdcclist: do linex=linesinfile(sfile) if exists(sfile) then do select when name='' then amirccmd='echo' when name='#' then amirccmd='say' otherwise do amirccmd='RAW PRIVMSG 'name' :' END end call open(1,sfile,r) cnt=0 do until eof(1) cnt=cnt+1 text=readln(1) if (cnt=1)&(~eof(1)) then do amirccmd '** AmIRC XDCC: 'linex' Files offered, "/ctcp 'mynick' xdcc get #<number>" to send one' amirccmd '** There are 'maxslots-checkslots()' of 'maxslots' slots available SEC: 'Security' KICK: 'Kick'' END if eof(1)=0 then do line=amirccmd' #'cnt'. 'word(text,1) do until length(line)>=25 line=line||' ' end IF RIGHT(text,4)="PACK" THEN DO pname=left(word(text,1),pos('/',word(text,1))-1) line=line||"("linesinfile('xdcc:'pname'list')' Files | ' call open(xf,'xdcc:'pname'list',r) sizex=0 do until eof(xf) sline=readln(xf) IF Length(sline)~=0 THEN sizex=sizex+word(sline,2) END call close(xf) IF sizex%1024>1024 THEN line=line||left((sizex/1048576),3)'M)' ELSE line=line||(sizex%1024)'K)' do while length(line)<30 line=line||' ' end text=left(text,length(text)-4) line=line||right(text,(length(text))-length(word(text,1))) END ELSE DO if word(statef("xdcc:"word(text,1)),2)%1024>=1024 then do line=line||'('left((word(statef('xdcc:'word(text,1)),2)/1048576),3)'M)' end else line=line||'('word(statef("xdcc:"word(text,1)),2)%1024'k)' do while length(line)<30 line=line||' ' end line=line||right(text,(length(text))-length(word(text,1))) end line end end call close(1) end else 'echo No list created.' end RETURN xdccsend: do if length(name)>0 then do if exists(sfile) then do cnt=0 call open(1,sfile,r) if datatype(file,n) then do do while (eof(1)=0)&(cnt<file) text=readln(1) cnt=cnt+1 end end else do if exists(file) then text=file end call close(1) IF Right(word(text,1),1)='/' THEN DO IF linesinfile('xdcc:'Left(word(text,1),Length(word(text,1))-1)'list')<=(maxslots-checkslots()) THEN DO call open(pxf,'xdcc:'Left(word(text,1),Length(word(text,1))-1)'list',r) DO UNTIL eof(pxf) pfile=readln(pxf) pfile=word(pfile,1) IF exists('xdcc:'word(text,1)||pfile) THEN DO 'echo Sending 'word(text,1)||pfile' to 'name'.' 'say /dcc send 'name' xdcc:'word(text,1)||pfile END END call close(pxf) END ELSE DO 'RAW PRIVMSG 'name' : You need 'linesinfile('xdcc:'Left(word(text,1),Length(word(text,1))-1)'list')' slots, only 'maxslots-checkslots()' slots are available' END END ELSE DO IF (maxslots-checkslots())>0 THEN DO 'echo Sending 'word(text,1)' to 'name'.' 'say /dcc send 'name' xdcc:'word(text,1) END ELSE DO 'RAW PRIVMSG 'name' : You need 1 slot, only 'maxslots-checkslots()' slots are available' END END end else 'echo Could not find 'sfile'.' end else 'echo Nick not specified.' end RETURN flist: do if exists(ffile) then do select when name='' then amirccmd='echo' when name='#' then amirccmd='say' otherwise amirccmd='RAW PRIVMSG 'name' :' end call open(1,ffile,r) cnt=0 do until eof(1) cnt=cnt+1 text=readln(1) if (cnt=1)&(~eof(1)) then amirccmd u'AmIRC XDCC:'u' Friends list' if eof(1)=0 then do line=amirccmd' 'cnt'. 'word(text,1) do until length(line)>=25 line=line||' ' end do while length(line)<30 line=line||' ' end line=line||right(text,(length(text))-length(word(text,1))) line end end call close(1) end else 'echo No list created.' end RETURN fdel: do if exists(ffile) then do call open(1,ffile,r) call open(2,'T:xdcc.temp',w) nfound=1 if datatype(name,n) then do cnt=0 do until eof(1) cnt=cnt+1 text=readln(1) if cnt~=name then call writeln(2,text) else do if eof(1)=0 then do 'echo Removing Item #'cnt', 'u||text||u' from xdcc list.' nfound=0 end end end end else do do until eof(1) text=readln(1) if word(upper(text),1)~=upper(name) then call writeln(2,text) else do 'echo Removing 'u||text||u' from xdcc list.' nfound=0 end end end call close(1) call close(2) if nfound then 'echo Nothing removed.' else do if exists('T:xdcc.temp') then do call open(1,'T:xdcc.temp',r) call open(2,ffile,w) cnt=1 do until eof(1) text=readln(1) if (~eof(1))&(strip(text)>0) then do call writeln(2,text) cnt=0 end end call close(1) call close(2) call delete('T:xdcc.temp') end if cnt then do 'echo List now empty.' call delete(ffile) end end end else 'echo List is empty.' end RETURN oplist: do if exists(ofile) then do select when name='' then amirccmd='echo' when name='#' then amirccmd='say' otherwise amirccmd='RAW PRIVMSG 'name' :' end call open(1,ofile,r) cnt=0 do until eof(1) cnt=cnt+1 text=readln(1) if (cnt=1)&(~eof(1)) then amirccmd u'AmIRC XDCC:'u' Friends list' if eof(1)=0 then do line=amirccmd' 'cnt'. 'word(text,1) do until length(line)>=25 line=line||' ' end do while length(line)<30 line=line||' ' end line=line||right(text,(length(text))-length(word(text,1))) line end end call close(1) end else 'echo No list created.' end RETURN opdel: do if exists(ofile) then do call open(1,ofile,r) call open(2,'T:xdcc.temp',w) nfound=1 if datatype(name,n) then do cnt=0 do until eof(1) cnt=cnt+1 text=readln(1) if cnt~=name then call writeln(2,text) else do if eof(1)=0 then do 'echo Removing Item #'cnt', 'u||text||u' from xdcc list.' nfound=0 end end end end else do do until eof(1) text=readln(1) if word(upper(text),1)~=upper(name) then call writeln(2,text) else do 'echo Removing 'u||text||u' from xdcc list.' nfound=0 end end end call close(1) call close(2) if nfound then 'echo Nothing removed.' else do if exists('T:xdcc.temp') then do call open(1,'T:xdcc.temp',r) call open(2,ofile,w) cnt=1 do until eof(1) text=readln(1) if (~eof(1))&(strip(text)>0) then do call writeln(2,text) cnt=0 end end call close(1) call close(2) call delete('T:xdcc.temp') end if cnt then do 'echo List now empty.' call delete(ofile) end end end else 'echo List is empty.' end RETURN xdcchelp: DO send=1 select when name='' then amirccmd='echo' when name='#' then amirccmd='say' otherwise amirccmd='RAW PRIVMSG 'name' :' END select when exists('rexx/xdcc.amirx') then call open(1,'rexx/xdcc.amirx') when exists('rexx:xdcc.amirx') then call open(1,'rexx:xdcc.amirx') when exists('amitcp:rexx/xdcc.amirx') then call open(1,'amitcp:rexx/xdcc.amirx') when exists('SYS:rexx/xdcc.amirx') then call open(1,'SYS:rexx/xdcc.amirx') when exists('xdcc.amirx') then call open(1,'xdcc.amirx') otherwise do 'echo Could not find arexx program.' send=0 end end if send then do send=0 do until eof(1) text=readln(1) if text='@' then send=1-send else if send then amirccmd strip(text,'B',' ') end call close(1) end end RETURN xdcclocalhelp: DO send=1 amirccmd='echo P='d2c(27)'bXDCCHelp' select when exists('rexx/xdcc.amirx') then call open(1,'rexx/xdcc.amirx') when exists('rexx:xdcc.amirx') then call open(1,'rexx:xdcc.amirx') when exists('amitcp:rexx/xdcc.amirx') then call open(1,'amitcp:rexx/xdcc.amirx') when exists('SYS:rexx/xdcc.amirx') then call open(1,'SYS:rexx/xdcc.amirx') when exists('xdcc.amirx') then call open(1,'xdcc.amirx') otherwise do 'echo Could not find arexx program.' send=0 end end if send~=0 then do send=0 do until eof(1) text=readln(1) if text='%' then send=1-send if text='@' then nop else if send~=0 then amirccmd strip(text,'B',' ') end call close(1) end end RETURN xdccinfo: do select when name='' then amirccmd='echo' when name='#' then amirccmd='say' otherwise do amirccmd='RAW PRIVMSG 'name' :' END end amirccmd '** AmIRC XDCC: 'linesinfile(sfile)' Files offered, "/ctcp 'mynick' xdcc list" for file list' amirccmd '** There are 'maxslots-checkslots()' of 'maxslots' slots available SEC: 'Security' KICK: 'Kick'' END RETURN linesinfile: PARSE ARG filecheck lines=0 IF exists(filecheck) THEN DO Open(check,filecheck,r) Do until eof(check) linelen=readln(check) IF Length(linelen)>1 THEN lines=lines+1 END Close(check) END RETURN lines scrap: RETURN checkslots: DO list=showlist(w) xpos=1 slots=0 DO until xpos=0 xpos=Pos('AmIRC DCC Send Thread',list,xpos+22) IF xpos>0 then slots=slots+1 END END RETURN slots